<?php

defined('SYSPATH') or die('No direct script access.');

class Site {

    public static function get_navigator() {

        $data = array();
        $navigators_temp = ORM::factory('news_category')
                ->where('is_index', '=', '1')
                ->order_by('position')
                ->find_all()
                ->as_array();

        foreach ($navigators_temp as $key => $value) {
            $childs = Catehelp::get_childs($value->id_category, 'news_categories', 'id_category');
            $data['id_category'] = $value->id_category;
            $data['name'] = $value->name;
            $data['eta_url'] = $value->meta_url;
            if(!empty ($childs) && is_array($childs)) {
                 $data['childs'] = $childs;
            }
            $navigators[$value->id_category] = $data;
            unset ($data);
        }

        return $navigators;
    }

}
